3.316 \(\int (a+a \sec (c+d x))^2 (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\)

Optimal. Leaf size=103 \[ \frac{2 a^2 (3 B+2 C) \tan (c+d x)}{3 d}+\frac{a^2 (3 B+2 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{a^2 (3 B+2 C) \tan (c+d x) \sec (c+d x)}{6 d}+\frac{C \tan (c+d x) (a \sec (c+d x)+a)^2}{3 d} \]

[Out]

(a^2*(3*B + 2*C)*ArcTanh[Sin[c + d*x]])/(2*d) + (2*a^2*(3*B + 2*C)*Tan[c + d*x])/(3*d) + (a^2*(3*B + 2*C)*Sec[
c + d*x]*Tan[c + d*x])/(6*d) + (C*(a + a*Sec[c + d*x])^2*Tan[c + d*x])/(3*d)

________________________________________________________________________________________

Rubi [A]  time = 0.106857, antiderivative size = 103, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 7, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.219, Rules used = {4054, 12, 3788, 3767, 8, 4046, 3770} \[ \frac{2 a^2 (3 B+2 C) \tan (c+d x)}{3 d}+\frac{a^2 (3 B+2 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{a^2 (3 B+2 C) \tan (c+d x) \sec (c+d x)}{6 d}+\frac{C \tan (c+d x) (a \sec (c+d x)+a)^2}{3 d} \]

Antiderivative was successfully verified.

[In]

Int[(a + a*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(a^2*(3*B + 2*C)*ArcTanh[Sin[c + d*x]])/(2*d) + (2*a^2*(3*B + 2*C)*Tan[c + d*x])/(3*d) + (a^2*(3*B + 2*C)*Sec[
c + d*x]*Tan[c + d*x])/(6*d) + (C*(a + a*Sec[c + d*x])^2*Tan[c + d*x])/(3*d)

Rule 4054

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) +
 (a_))^(m_.), x_Symbol] :> -Simp[(C*Cot[e + f*x]*(a + b*Csc[e + f*x])^m)/(f*(m + 1)), x] + Dist[1/(b*(m + 1)),
 Int[(a + b*Csc[e + f*x])^m*Simp[A*b*(m + 1) + (a*C*m + b*B*(m + 1))*Csc[e + f*x], x], x], x] /; FreeQ[{a, b,
e, f, A, B, C, m}, x] && EqQ[a^2 - b^2, 0] &&  !LtQ[m, -2^(-1)]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 3788

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Dist[(2*a*b)/
d, Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b
, d, e, f, n}, x]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 4046

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> -Simp[(C*Cot[
e + f*x]*(b*Csc[e + f*x])^m)/(f*(m + 1)), x] + Dist[(C*m + A*(m + 1))/(m + 1), Int[(b*Csc[e + f*x])^m, x], x]
/; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] &&  !LeQ[m, -1]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+a \sec (c+d x))^2 \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac{C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac{\int a (3 B+2 C) \sec (c+d x) (a+a \sec (c+d x))^2 \, dx}{3 a}\\ &=\frac{C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac{1}{3} (3 B+2 C) \int \sec (c+d x) (a+a \sec (c+d x))^2 \, dx\\ &=\frac{C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac{1}{3} (3 B+2 C) \int \sec (c+d x) \left (a^2+a^2 \sec ^2(c+d x)\right ) \, dx+\frac{1}{3} \left (2 a^2 (3 B+2 C)\right ) \int \sec ^2(c+d x) \, dx\\ &=\frac{a^2 (3 B+2 C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac{C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac{1}{2} \left (a^2 (3 B+2 C)\right ) \int \sec (c+d x) \, dx-\frac{\left (2 a^2 (3 B+2 C)\right ) \operatorname{Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=\frac{a^2 (3 B+2 C) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac{2 a^2 (3 B+2 C) \tan (c+d x)}{3 d}+\frac{a^2 (3 B+2 C) \sec (c+d x) \tan (c+d x)}{6 d}+\frac{C (a+a \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end{align*}

Mathematica [A]  time = 0.334829, size = 63, normalized size = 0.61 \[ \frac{a^2 \left ((9 B+6 C) \tanh ^{-1}(\sin (c+d x))+\tan (c+d x) \left (3 (B+2 C) \sec (c+d x)+12 (B+C)+2 C \tan ^2(c+d x)\right )\right )}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Sec[c + d*x])^2*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(a^2*((9*B + 6*C)*ArcTanh[Sin[c + d*x]] + Tan[c + d*x]*(12*(B + C) + 3*(B + 2*C)*Sec[c + d*x] + 2*C*Tan[c + d*
x]^2)))/(6*d)

________________________________________________________________________________________

Maple [A]  time = 0.041, size = 141, normalized size = 1.4 \begin{align*}{\frac{3\,B{a}^{2}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{2\,d}}+{\frac{5\,{a}^{2}C\tan \left ( dx+c \right ) }{3\,d}}+2\,{\frac{B{a}^{2}\tan \left ( dx+c \right ) }{d}}+{\frac{{a}^{2}C\sec \left ( dx+c \right ) \tan \left ( dx+c \right ) }{d}}+{\frac{{a}^{2}C\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+{\frac{B{a}^{2}\sec \left ( dx+c \right ) \tan \left ( dx+c \right ) }{2\,d}}+{\frac{{a}^{2}C\tan \left ( dx+c \right ) \left ( \sec \left ( dx+c \right ) \right ) ^{2}}{3\,d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x)

[Out]

3/2/d*B*a^2*ln(sec(d*x+c)+tan(d*x+c))+5/3/d*a^2*C*tan(d*x+c)+2/d*B*a^2*tan(d*x+c)+1/d*a^2*C*sec(d*x+c)*tan(d*x
+c)+1/d*a^2*C*ln(sec(d*x+c)+tan(d*x+c))+1/2/d*B*a^2*sec(d*x+c)*tan(d*x+c)+1/3/d*a^2*C*tan(d*x+c)*sec(d*x+c)^2

________________________________________________________________________________________

Maxima [A]  time = 0.941812, size = 225, normalized size = 2.18 \begin{align*} \frac{4 \,{\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C a^{2} - 3 \, B a^{2}{\left (\frac{2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 6 \, C a^{2}{\left (\frac{2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, B a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 24 \, B a^{2} \tan \left (d x + c\right ) + 12 \, C a^{2} \tan \left (d x + c\right )}{12 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/12*(4*(tan(d*x + c)^3 + 3*tan(d*x + c))*C*a^2 - 3*B*a^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x +
 c) + 1) + log(sin(d*x + c) - 1)) - 6*C*a^2*(2*sin(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log
(sin(d*x + c) - 1)) + 12*B*a^2*log(sec(d*x + c) + tan(d*x + c)) + 24*B*a^2*tan(d*x + c) + 12*C*a^2*tan(d*x + c
))/d

________________________________________________________________________________________

Fricas [A]  time = 0.508882, size = 315, normalized size = 3.06 \begin{align*} \frac{3 \,{\left (3 \, B + 2 \, C\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \,{\left (3 \, B + 2 \, C\right )} a^{2} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \,{\left (2 \,{\left (6 \, B + 5 \, C\right )} a^{2} \cos \left (d x + c\right )^{2} + 3 \,{\left (B + 2 \, C\right )} a^{2} \cos \left (d x + c\right ) + 2 \, C a^{2}\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/12*(3*(3*B + 2*C)*a^2*cos(d*x + c)^3*log(sin(d*x + c) + 1) - 3*(3*B + 2*C)*a^2*cos(d*x + c)^3*log(-sin(d*x +
 c) + 1) + 2*(2*(6*B + 5*C)*a^2*cos(d*x + c)^2 + 3*(B + 2*C)*a^2*cos(d*x + c) + 2*C*a^2)*sin(d*x + c))/(d*cos(
d*x + c)^3)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} a^{2} \left (\int B \sec{\left (c + d x \right )}\, dx + \int 2 B \sec ^{2}{\left (c + d x \right )}\, dx + \int B \sec ^{3}{\left (c + d x \right )}\, dx + \int C \sec ^{2}{\left (c + d x \right )}\, dx + \int 2 C \sec ^{3}{\left (c + d x \right )}\, dx + \int C \sec ^{4}{\left (c + d x \right )}\, dx\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))**2*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

a**2*(Integral(B*sec(c + d*x), x) + Integral(2*B*sec(c + d*x)**2, x) + Integral(B*sec(c + d*x)**3, x) + Integr
al(C*sec(c + d*x)**2, x) + Integral(2*C*sec(c + d*x)**3, x) + Integral(C*sec(c + d*x)**4, x))

________________________________________________________________________________________

Giac [A]  time = 1.18855, size = 240, normalized size = 2.33 \begin{align*} \frac{3 \,{\left (3 \, B a^{2} + 2 \, C a^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 1 \right |}\right ) - 3 \,{\left (3 \, B a^{2} + 2 \, C a^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 1 \right |}\right ) - \frac{2 \,{\left (9 \, B a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{5} + 6 \, C a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{5} - 24 \, B a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 16 \, C a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} + 15 \, B a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + 18 \, C a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(d*x+c))^2*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

1/6*(3*(3*B*a^2 + 2*C*a^2)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(3*B*a^2 + 2*C*a^2)*log(abs(tan(1/2*d*x + 1/
2*c) - 1)) - 2*(9*B*a^2*tan(1/2*d*x + 1/2*c)^5 + 6*C*a^2*tan(1/2*d*x + 1/2*c)^5 - 24*B*a^2*tan(1/2*d*x + 1/2*c
)^3 - 16*C*a^2*tan(1/2*d*x + 1/2*c)^3 + 15*B*a^2*tan(1/2*d*x + 1/2*c) + 18*C*a^2*tan(1/2*d*x + 1/2*c))/(tan(1/
2*d*x + 1/2*c)^2 - 1)^3)/d